# 1导包
import jsonschema

# 2 准备待校验的数据
data = {
    "success": True,
    "code": 10000,
    "message": "操作成功"
}

# 3 定义schema规则
schema = {
    "type": "object",
    "properties": {"success": {"type": "boolean"},
                   "code": {"type": "integer"},
                   "message": {"type": "string"}},
    "required": ["success", "code", "message"]

}
#4 valide校验
resp = jsonschema.validate(instance=data,schema=schema)
print("resp=",resp)
